/*     */ package com.cr.business;
/*     */ 
/*     */ import com.cr.business.domain.CrAnswer;
/*     */ import com.cr.business.service.ICrAnswerService;
/*     */ import com.cr.business.service.ICrQuestionService;
/*     */ import com.cr.business.service.ICrUserService;
/*     */ import com.cr.common.annotation.Log;
/*     */ import com.cr.common.core.controller.BaseController;
/*     */ import com.cr.common.core.domain.AjaxResult;
/*     */ import com.cr.common.core.page.TableDataInfo;
/*     */ import com.cr.common.enums.BusinessType;
/*     */ import com.cr.common.utils.poi.ExcelUtil;
/*     */ import java.util.List;
/*     */ import org.apache.shiro.authz.annotation.RequiresPermissions;
/*     */ import org.springframework.beans.factory.annotation.Autowired;
/*     */ import org.springframework.stereotype.Controller;
/*     */ import org.springframework.ui.ModelMap;
/*     */ import org.springframework.web.bind.annotation.GetMapping;
/*     */ import org.springframework.web.bind.annotation.PathVariable;
/*     */ import org.springframework.web.bind.annotation.PostMapping;
/*     */ import org.springframework.web.bind.annotation.RequestMapping;
/*     */ import org.springframework.web.bind.annotation.ResponseBody;
/*     */ 
/*     */ @Controller
/*     */ @RequestMapping({"/business/answer"})
/*     */ public class CrAnswerController extends BaseController {
/*  36 */   private String prefix = "business/answer";
/*     */   
/*     */   @Autowired
/*     */   private ICrAnswerService crAnswerService;
/*     */   
/*     */   @Autowired
/*     */   private ICrUserService userService;
/*     */   
/*     */   @Autowired
/*     */   private ICrQuestionService questionService;
/*     */   
/*     */   @RequiresPermissions({"business:answer:view"})
/*     */   @GetMapping
/*     */   public String answer(ModelMap mmap) {
/*  51 */     mmap.put("userList", this.userService.selectCrUserList(null));
/*  52 */     mmap.put("questionList", this.questionService.selectCrQuestionList(null));
/*  53 */     return this.prefix + "/answer";
/*     */   }
/*     */   
/*     */   @RequiresPermissions({"business:answer:list"})
/*     */   @PostMapping({"/list"})
/*     */   @ResponseBody
/*     */   public TableDataInfo list(CrAnswer crAnswer) {
/*  64 */     startPage();
/*  65 */     List<CrAnswer> list = this.crAnswerService.selectCrAnswerList(crAnswer);
/*  66 */     return getDataTable(list);
/*     */   }
/*     */   
/*     */   @RequiresPermissions({"business:answer:export"})
/*     */   @Log(title = "法律问答--回答", businessType = BusinessType.EXPORT)
/*     */   @PostMapping({"/export"})
/*     */   @ResponseBody
/*     */   public AjaxResult export(CrAnswer crAnswer) {
/*  78 */     List<CrAnswer> list = this.crAnswerService.selectCrAnswerList(crAnswer);
/*  79 */     ExcelUtil<CrAnswer> util = new ExcelUtil(CrAnswer.class);
/*  80 */     return util.exportExcel(list, "法律问答--回答数据");
/*     */   }
/*     */   
/*     */   @GetMapping({"/add"})
/*     */   public String add(ModelMap mmap) {
/*  89 */     mmap.put("userList", this.userService.selectCrUserList(null));
/*  90 */     mmap.put("questionList", this.questionService.selectCrQuestionList(null));
/*  91 */     return this.prefix + "/add";
/*     */   }
/*     */   
/*     */   @RequiresPermissions({"business:answer:add"})
/*     */   @Log(title = "法律问答--回答", businessType = BusinessType.INSERT)
/*     */   @PostMapping({"/add"})
/*     */   @ResponseBody
/*     */   public AjaxResult addSave(CrAnswer crAnswer) {
/* 103 */     return toAjax(this.crAnswerService.insertCrAnswer(crAnswer));
/*     */   }
/*     */   
/*     */   @GetMapping({"/edit/{answerId}"})
/*     */   public String edit(@PathVariable("answerId") Long answerId, ModelMap mmap) {
/* 112 */     mmap.put("userList", this.userService.selectCrUserList(null));
/* 113 */     mmap.put("questionList", this.questionService.selectCrQuestionList(null));
/* 114 */     CrAnswer crAnswer = this.crAnswerService.selectCrAnswerByAnswerId(answerId);
/* 115 */     mmap.put("crAnswer", crAnswer);
/* 116 */     return this.prefix + "/edit";
/*     */   }
/*     */   
/*     */   @RequiresPermissions({"business:answer:edit"})
/*     */   @Log(title = "法律问答--回答", businessType = BusinessType.UPDATE)
/*     */   @PostMapping({"/edit"})
/*     */   @ResponseBody
/*     */   public AjaxResult editSave(CrAnswer crAnswer) {
/* 128 */     return toAjax(this.crAnswerService.updateCrAnswer(crAnswer));
/*     */   }
/*     */   
/*     */   @RequiresPermissions({"business:answer:remove"})
/*     */   @Log(title = "法律问答--回答", businessType = BusinessType.DELETE)
/*     */   @PostMapping({"/remove"})
/*     */   @ResponseBody
/*     */   public AjaxResult remove(String ids) {
/* 140 */     return toAjax(this.crAnswerService.deleteCrAnswerByAnswerIds(ids));
/*     */   }
/*     */   
/*     */   @GetMapping({"/audit/{answerId}"})
/*     */   public String audit(@PathVariable("answerId") Long answerId, ModelMap mmap) {
/* 149 */     CrAnswer crAnswer = this.crAnswerService.selectCrAnswerByAnswerId(answerId);
/* 150 */     mmap.put("crAnswer", crAnswer);
/* 151 */     return this.prefix + "/audit";
/*     */   }
/*     */   
/*     */   @RequiresPermissions({"business:answer:edit"})
/*     */   @Log(title = "法律问答--回答", businessType = BusinessType.UPDATE)
/*     */   @PostMapping({"/audit"})
/*     */   @ResponseBody
/*     */   public AjaxResult auditSave(CrAnswer crAnswer) {
/* 163 */     return toAjax(this.crAnswerService.updateCrAnswer(crAnswer));
/*     */   }
/*     */   
/*     */   @GetMapping({"/info/{answerId}"})
/*     */   public String info(@PathVariable("answerId") Long answerId, ModelMap mmap) {
/* 172 */     mmap.put("userList", this.userService.selectCrUserList(null));
/* 173 */     mmap.put("questionList", this.questionService.selectCrQuestionList(null));
/* 174 */     CrAnswer crAnswer = this.crAnswerService.selectCrAnswerByAnswerId(answerId);
/* 175 */     mmap.put("crAnswer", crAnswer);
/* 176 */     return this.prefix + "/info";
/*     */   }
/*     */ }


/* Location:              D:\tmp\creditorRights-admin\BOOT-INF\classes\com.zip!\com\cr\business\CrAnswerController.class
 * Java compiler version: 8 (52.0)
 * JD-Core Version:       1.1.3
 */